package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.BatchSurplusRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 流水记录表
 * @author lee
 * @date 2020/1/13 16:51
 * @since v1.0
 * @version v1.0
 */
@Repository
@Mapper
public interface BatchSurplusRecordDao {
    /**
     * 插入数据
     *
     * @param stockSurplusRecordEntity 表单实体数据
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    Integer insert(BatchSurplusRecordEntity stockSurplusRecordEntity);
    /**
     * 更新数据
     *
     * @param stockSurplusRecordEntity 表单实体数据
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    Integer update(BatchSurplusRecordEntity stockSurplusRecordEntity);
    /**
     * 删除单条数据
     *
     * @param key 主键
     * @param corpid 公司ID
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);
    /**
     * 根据索引查询数据
     *
     * @param key 主键
     * @param corpid 公司ID
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    BatchSurplusRecordEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);
    /**
     * 根据索引查询数据
     *
     * @param param 查询参数
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    List<BatchSurplusRecordEntity> findEntitys(@Param("param") Map<String, Object> param);
    /**
     * 获取数据条数
     *
     * @param param 查询参数
     * @author lee
     * @date 2020/1/13 16:51
     * @since v1.0
     * @version v1.0
     **/
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    Integer insertBatch(@Param("list") List<BatchSurplusRecordEntity> stockSurplusRecordEntityList);

    Integer updateBatch(@Param("list") List<BatchSurplusRecordEntity> list, @Param("corpid") String corpid);

    List<BatchSurplusRecordEntity> getLatestFlowBillByBatchKey(@Param("param") Map<String, Object> param);

    void deleteAllByCorpId(@Param("corpid")String corpid);

    void insertRecordsFromBatchStock(@Param("corpid")String corpid, @Param("date")Long monthBeforeInt);

    void deleteByAddTime(@Param("param") Map<String, Object> param);

    void batchInsertRecordsFromBatchStock(@Param("param") Map<String, Object> param);
}
